<template>
	<view class="mine-agreement" v-if="detail.id">
		<view class="pd-lg">
			<parser :html="detail.text" @linkpress="linkpress" show-with-animation lazy-load>加载中...</parser>
		</view>
		<view class="space-footer"></view>
	</view>
</template>

<script>
	import {
		mapState,
	} from "vuex"
	import parser from "@/components/jyf-Parser/index"
	export default {
		components: {
			parser
		},
		data() {
			return {
				options: {},
				detail: {},
				popupInfo: {}
			}
		},
		computed: mapState({
			primaryColor: state => state.config.configInfo.primaryColor,
			subColor: state => state.config.configInfo.subColor,
			configInfo: state => state.config.configInfo,
			userInfo: state => state.user.userInfo,
		}),
		onLoad(options) {
			this.$util.showLoading()
			this.options = options
			this.initIndex()
		},
		onUnload() {
			this.$util.back()
		},
		methods: {
			async initIndex() {
				let {
					type
				} = this.options
				this.detail = await this.$api.home.aboutUsInfoType({
					type
				})
				let {
					title
				} = this.detail
				uni.setNavigationBarTitle({
					title
				})
				this.$util.hideAll()
			},
			initRefresh() {
				this.initIndex()
			},
			linkpress(res) {
				console.log("linkpress", res);
				// #ifdef APP-PLUS
				this.$util.goUrl({
					url: res.href,
					openType: 'web'
				})
				// #endif
			}
		}
	}
</script>


<style lang="scss">
	page {
		background: #fff
	}
</style>
